﻿@model  BrnMall.Web.StoreAdmin.Models.StoreWxAppModel

@section header{
    <title>编辑小程序设置-店铺分类</title>
    <link type="text/css" rel="stylesheet" href="/admin_store/css/site.css" />
    <script type="text/javascript" src="/admin_store/scripts/jquery.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.js"></script>
    <script type="text/javascript" src="/admin_store/scripts/jquery.validate.unobtrusive.js"></script>
<link type="text/css" rel="stylesheet" href="/components/webuploader/webuploader.css" />
    <script type="text/javascript" src="/components/webuploader/webuploader.js"></script>
<script type="text/javascript">
    delMessage = "如果图片为主图或轮播图,请您重新设置,您确定要删除吗？";

    $(function () {
        var uploader = WebUploader.create({
            pick: '.uploadBut',
            auto: true,
            swf: '/components/webuploader/Uploader.swf',
            server: '/storeadmin/tool/upload?operation=uploadwxpaycert',
            fileVal: 'upload',
            accept: {
                title: 'Images',
                extensions: '*',
                mimeTypes: '*'
            }
            });

        uploader.on('uploadProgress', function(file, percentage) {
            $(".uploadPreview").html("上传中...");
        });

        uploader.on('uploadSuccess', function(file, response) {
            var data = response._raw;
            if (data == "-1")
                $("#errMessage").html('证书不能为空');
            else if (data == "-2")
                $("#errMessage").html('证书类型不允许');
            else {
                $("#errMessage").html("上传成功,请提交保存");
                $("#CertPath").val(data);
            }
        });

        uploader.on('uploadError', function(file) {
            $("#errMessage").html("上传失败");
        });
    });

    
</script>

}
@section body{
    <h1 class="rightH1">
		微信小程序 &gt; 店铺管理 &gt; 店铺分类 &gt;
		@if (Model.StoreWid > 0)
		{
			<span class="rightH1-cur">修改小程序设置</span>
		}
		else
		{
			<span class="rightH1-cur">添加小程序设置</span>
		}
        <div class="right">
            <a href="@Url.Action("StoreWxApp")" class="menuBT"><img src="/admin_store/images/goback.jpg"/>返回列表</a>
            <div class="clear"></div>
        </div>
        <div class="clear"></div>
    </h1>
    <div class="addTable">
        @using (Html.BeginForm())
        {

            @Html.HiddenFor(x => x.Active)
            <table width="100%">
                <thead>
					<tr>
						<td colspan="2"  class="rightH1-cur" style="padding-left:10px; font-size: 18px">小程序设置</td>
					</tr>
                </thead>
                <tr>
                    <td style="width:150px;" align="right">
                        是否默认：
                    </td>
                    <td>
                        @Html.CheckBoxFor(x => x.IsDefault)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        小程序ID：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.WeAppId, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.WeAppId)
                    </td>
                </tr>

               
                
                <tr>
                    <td align="right">
                        发货消息模板ID：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.DeliverSuccessTid, new {@class = "input", size = "50"})@Html.ValidationMessageFor(x => x.DeliverSuccessTid)
						<a href="@WorkContext.ImageCDN/images/delivertemplate.png" class="button button-orange" style="height:26px;line-height:25px" target="_blank">查看帮助</a>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        支付成功消息模板ID：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.PaySuccessTid, new {@class = "input", size = "50"})@Html.ValidationMessageFor(x => x.PaySuccessTid)
						<a href="@WorkContext.ImageCDN/images/paytemplate.png" class="button button-orange" style="height:26px;line-height:25px" target="_blank">查看帮助</a>

                    </td>
                </tr>
                <tr>
                    <td align="right">
                        预约成功消息模板ID：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.AppointMentSuccessTid, new { @class = "input", size = "50" })@Html.ValidationMessageFor(x => x.AppointMentSuccessTid)
                        <a href="@WorkContext.ImageCDN/images/AppointMenttemplate.png" class="button button-orange" style="height:26px;line-height:25px" target="_blank">查看帮助</a>
                    </td>
                </tr>
                <tr>                  
                    <td align="right">
                        预约处理消息模板ID：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.AppointMentDisposeSuccessTid, new { @class = "input", size = "50" })@Html.ValidationMessageFor(x => x.AppointMentDisposeSuccessTid)
                        <a href="@WorkContext.ImageCDN/images/AppointMentDisposetemplate.png" class="button button-orange" style="height:26px;line-height:25px" target="_blank">查看帮助</a>
                    </td>
                </tr>
                @*<tr>
                    
                    <td align="right">
                        未读回信提醒模板ID：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.SendMsgCallbackTid, new { @class = "input", size = "50" })@Html.ValidationMessageFor(x => x.SendMsgCallbackTid)
                        <a href="https://static.711688.net.cn/images/SendMsgCallbackTemplate.png" class="button button-orange" style="height:26px;line-height:25px" target="_blank">查看帮助</a>
                    </td>
                </tr>*@

                <tr>
                    <td align="right">
                        支付方式：
                    </td>
                    <td>
                        @Html.RadioButtonFor(x => x.PayType, 0, new { name = "PayType" })
                        微信支付
                        @Html.RadioButtonFor(x => x.PayType, 1, new { name = "PayType" })
                        微街支付
                    </td>
                </tr>
            </table>
            <table width="100%" id="psbctable" style="display: none">
                <thead>
                <tr>
                    <td style="width:150px;"></td>
                    <td class="rightH1-cur" style="font-size: 18px">微街支付设置</td>
                </tr>

                </thead>
                <tr>
                    <td align="right">微街支付商户ID：</td>
                    <td>
                        @Html.TextBoxFor(x => x.PsbcMchId, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.PsbcMchId)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        微街支付商户KEY：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.PsbcMchKey, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.PsbcMchKey)
                    </td>
                </tr>
            </table>

			<div class="xuxian">

			</div>
            <table width="100%" id="weixintable" style="display: none">
                <thead>
                <tr>
                    <td colspan="2" class="rightH1-cur" style="padding-left:10px; font-size: 18px">微信支付设置</td>
                </tr>
                </thead>
                <tr>
                    <td style="width:150px" align="right">微信支付商户ID：</td>
                    <td>
                        @Html.TextBoxFor(x => x.MchId, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.MchId)
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        微信支付商户KEY：
                    </td>
                    <td>
                        @Html.TextBoxFor(x => x.MchKey, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.MchKey)

                        @Html.HiddenFor(x => x.StoreId, new {@class = "input", size = "3"})@Html.ValidationMessageFor(x => x.StoreId)
                        @Html.HiddenFor(x => x.StoreWid, new {@class = "input", size = "35"})@Html.ValidationMessageFor(x => x.StoreWid)
                        说明: 微信支付商户KEY,在微信商户平台中“账户设置”--“账户安全”--“设置API密钥”中查看。
                    </td>
                </tr>
                <tr>
                    <td width="66px" align="right">证书名称：</td>
                    <td>@Model.CertPath</td>
                </tr>
                <tr>
                    <td width="66px" align="right">上传证书：</td>
                    <td>
                        <div class="upload">

                            <div class="left">
                                <div class="uploadBut">选择证书</div>
                            </div>
                            <div class="clear"></div>
                            <div class="left"><span id="errMessage" style="color: red"></span>
                            </div>
                            <div class="clear"></div>
                            <div class="left">
                                <p>1,上传格式为*****.p12,如：apiclient_cert.p12</p>
                                <p>2,设置好微信证书以后，才能使用微信红包和微信批量放款相关功能。</p>
                            </div>
                        </div>
                        <input type="hidden" name="CertPath" id="CertPath" value=""/>
                    </td>
                </tr>

            </table>

            <table width="100%">
                <tr>
                    <td style="width:180px" align="right">
                        &nbsp;
                    </td>
                    <td>
                        <a href="" class="addBt" id="sumbitBut">
                            <img src="/admin_store/images/submit.jpg"/>
                        </a>
                        <script type="text/javascript">
                            $(function () {
                                var payTypeValue = $("input[name='PayType']:checked").val();
                                if (payTypeValue == 0) {
                                    $("#weixintable").css("display", "block");
                                    $("#psbctable").css("display", "none");
                                } else {
                                    $("#psbctable").css("display", "block");
                                    $("#weixintable").css("display", "none");
                                }
                                $("input[name='PayType']").click(function () {
                                    var val = $(this).val();;
                                    console.log(val);
                                    if (val == 0) {
                                        $("#weixintable").css("display", "block");
                                        $("#psbctable").css("display", "none");
                                    } else {
                                        $("#psbctable").css("display", "block");
                                        $("#weixintable").css("display", "none");
                                    }
                                })
                                $("#sumbitBut").click(function() {
                                    $("form:first").submit();
                                    return false;
                                })
                            });
                        </script>
                    </td>
                </tr>
                <tr>
                    <td align="right">
                        &nbsp;
                    </td>
                    <td>
                        &nbsp;
                    </td>
                </tr>
            </table>
        }
    </div>
}
